<?php
// 确保必要参数已定义
if (!isset($milestone) || !isset($historyConfig)) {
    return;
}

// 处理年份显示
$yearClass = $historyConfig['timeline_direction'] === 'vertical' ? 
    'inline-block mb-3 px-3 py-1 text-sm font-semibold rounded-full bg-gray-100 ' . $historyConfig['accent_color'] . '/10 ' . $accentClass :
    'mb-4 text-xl font-bold ' . $accentClass;
?>

<div class="history-milestone bg-white p-6 rounded-xl shadow-sm hover:shadow-md transition-shadow duration-300">
    <?php if ($historyConfig['show_years'] && !empty($milestone['year'])): ?>
        <div class="<?php echo $yearClass; ?>">
            <?php echo htmlspecialchars($milestone['year']); ?>
        </div>
    <?php endif; ?>
    
    <?php if (!empty($milestone['title'])): ?>
        <h3 class="text-xl md:text-2xl font-bold text-gray-900 mb-3">
            <?php echo htmlspecialchars($milestone['title']); ?>
        </h3>
    <?php endif; ?>
    
    <?php if (!empty($milestone['description'])): ?>
        <p class="text-gray-600 mb-4">
            <?php echo htmlspecialchars($milestone['description']); ?>
        </p>
    <?php endif; ?>
    
    <?php if (!empty($milestone['achievements'])): ?>
        <ul class="space-y-2">
            <?php foreach ($milestone['achievements'] as $achievement): ?>
                <li class="flex items-start">
                    <i class="fa fa-check-circle <?php echo $accentClass; ?> mt-1 mr-2"></i>
                    <span class="text-gray-700"><?php echo htmlspecialchars($achievement); ?></span>
                </li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
    
    <?php if (!empty($milestone['image'])): ?>
        <div class="mt-4 rounded-lg overflow-hidden">
            <img 
                src="<?php echo htmlspecialchars($milestone['image']); ?>" 
                alt="<?php echo htmlspecialchars($milestone['title'] ?? '公司里程碑图片'); ?>"
                class="w-full h-48 object-cover transition-transform duration-500 hover:scale-105"
                loading="lazy"
            >
        </div>
    <?php endif; ?>
</div>
    